package com.lu.service;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.lu.model.dto.UserRoleResourcesDTO;
import com.lu.model.entity.SysUser;
import com.lu.model.domain.LoginUser;
import com.lu.model.request.*;
import org.springframework.security.core.userdetails.UserDetailsService;

import java.util.List;

/**
 * <p>
 * 用户信息表 服务类
 * </p>
 *
 * @author wangqieyu
 * @since 2022-07-26
 */
public interface SysUserService extends IService<SysUser>, UserDetailsService {

  /**
   * 用户登出
   * @return
   */
  void logout();

  Page<SysUser> pageList(UserQueryRequest request);

  Long addUser(UserAddRequest request);

  SysUser updateUser(UserUpdateRequest request);

  Integer updatePwd(UserUpdatePwdRequest request);

  Integer updateStatus(Long id, Integer status);

  String deleteUser(Long id);

  String updateRoles(UserRolesUpdateRequest request);

  SysUser getByUserId(Long id);

  /**
   * 获取菜单资源
   * @return
   */
  List<UserRoleResourcesDTO.TreeNodes> getUserRoleMenuResources();

  /**
   * 获取按钮资源
   * @return
   */
  List<UserRoleResourcesDTO> getUserRoleButtonResources();

  /**
   * 更新用户角色权限
   * @param userId
   * @return
   */
  LoginUser updateLoginUser(Long userId);

}
